# !/usr/bin/env python
# -*- coding: utf-8 -*-

import os

LOG_FULL_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "log/service.log")
LOGGING_DICT_CONFIG = {
    "version": 1,
    "disable_existing_loggers": True,
    "formatters": {
        "simple": {
            "format": '[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d] %(message)s'
        }
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "level": "NOTSET",
            "formatter": "simple",
            "stream": "ext://sys.stdout"
        },
        "all": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "NOTSET",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": LOG_FULL_PATH
        },
        "tornado": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": LOG_FULL_PATH
        },
        "apscheduler": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": LOG_FULL_PATH
        },
        "handlers": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": LOG_FULL_PATH
        }, "daemon": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": os.path.join(os.path.dirname(os.path.dirname(__file__)), "log/daemon.log")
        }
        , "execute_mq": {
            "class": "logging.handlers.TimedRotatingFileHandler",
            "level": "DEBUG",
            "formatter": "simple",
            "when": "D",
            "interval": 1,
            "filename": os.path.join(os.path.dirname(os.path.dirname(__file__)), "log/execute_mq.log")
        }
    },
    "loggers": {
        "all": {
            "level": "DEBUG",
            "handlers": ["all"],
            "propagate": False
        },
        "console": {
            "level": "NOTSET",
            "handlers": ["console"],
            "propagate": False
        },
        "tornado": {
            "level": "NOTSET",
            "handlers": ["tornado", "console"],
            "propagate": False
        },
        "apscheduler": {
            "level": "NOTSET",
            "handlers": ["apscheduler"],
            "propagate": False
        },
        "handlers": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        },
        "main": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        },
        "daemon": {
            "level": "NOTSET",
            "handlers": ["console", "daemon"],
            "propagate": True
        },
        "execute_mq": {
            "level": "NOTSET",
            "handlers": ["console", "execute_mq"],
            "propagate": True
        },
        "payment": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        },
        "wechat": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        },
        "common": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        },
        "helper": {
            "level": "NOTSET",
            "handlers": ["all", "console"],
            "propagate": False
        }
    },
    "root": {
        "level": "NOTSET",
        "handlers": ["console", "all"],
        "propagate": True
    }
}
